﻿using System;

using Android.App;
using Android.Content;
using Android.Runtime;
using Android.Views;
using Android.Widget;
using Android.OS;
using System.Xml;
using System.IO;
using System.Collections.Generic;
using System.Data.SqlClient;

namespace TestApp1
{
    [Activity(Label = "TestApp1", MainLauncher = true, Icon = "@drawable/icon")]
    public class Activity1 : Activity
    {
        double suntrustBalance = 1.38;
        double chaseBalance = 2.84;
        TextView suntrustTextview;
        TextView chaseTextview;
        TextView totalTextview;

        protected override void OnCreate(Bundle bundle)
        {
            base.OnCreate(bundle);
            SetContentView(Resource.Layout.Main);

            suntrustTextview = FindViewById<TextView>(Resource.Id.SuntrustTextView);
            chaseTextview = FindViewById<TextView>(Resource.Id.ChaseTextView);
            totalTextview = FindViewById<TextView>(Resource.Id.TotalTextView);

            Button button = FindViewById<Button>(Resource.Id.MyButton);
            button.Click += RetrieveBalances;
        }

        private void RetrieveBalances(object sender, EventArgs e)
        {
            //string temp = "";
            //StreamReader sreader = new StreamReader(@"..\..\..\..\TestApp1\JPMC.ofx");
            //string sline;

            //while ((sline = sreader.ReadLine()) != null)
            //{
            //    if (sline.Contains("<BALAMT>"))
            //    {
            //        temp = sline;
            //    }
            //}

            suntrustTextview.Text = string.Format("Suntrust checking account: ${0}", suntrustBalance);
            chaseTextview.Text = string.Format("Chase checking account: ${0}", chaseBalance);
            totalTextview.Text = string.Format("Total balance: ${0}", suntrustBalance + chaseBalance);
        }
    }
}